package com.cos.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.cos.common.MySerialize;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author: COS
 * @time: 2021/11/17 9:25
 * @description:
 */
public class User implements Serializable {
    private int uno;
//    @JsonIgnore//忽略属性
//    @JsonProperty("username")//设置json的属性名
    private String uname;
//    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String usex;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
//    @JsonFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd",name = "wahaha")
    private Date bornDate;
//    @JsonSerialize(using = MySerialize.class)
    private double salary;
    @Override
    public String toString() {
        return "User{" +
                "uno=" + uno +
                ", uname='" + uname + '\'' +
                ", usex='" + usex + '\'' +
                ", bornDate=" + bornDate +
                ", salary=" + salary +
                '}';
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public User(int uno, String uname, String usex, Date bornDate, double salary) {
        this.uno = uno;
        this.uname = uname;
        this.usex = usex;
        this.bornDate = bornDate;
        this.salary = salary;
    }

    public int getUno() {
        return uno;
    }

    public void setUno(int uno) {
        this.uno = uno;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getUsex() {
        return usex;
    }

    public void setUsex(String usex) {
        this.usex = usex;
    }

    public Date getBornDate() {
        return bornDate;
    }

    public void setBornDate(Date bornDate) {
        this.bornDate = bornDate;
    }

    public User() {
    }

    public User(int uno, String uname, String usex, Date bornDate) {
        this.uno = uno;
        this.uname = uname;
        this.usex = usex;
        this.bornDate = bornDate;
    }
}
